export default {
// 重写setItem事件，当使用setItem的时候，触发，window.dispatchEvent派发事件
    dispatchEventStroage() {
        const signSetItem = localStorage.setItem
        localStorage.setItem = function (key, val) {
            let setEvent = new Event('setItemEvent')
            setEvent.key = key
            setEvent.newValue = val
            window.dispatchEvent(setEvent)
            signSetItem.apply(this, arguments)
        }
    }

}


import ringPie from '../components/home/ringPie/index'
import gauge from '../components/home/gauge/index'
import rainbow from '../components/home/rainbow/index'
import dynamicList from '../components/home/dynamicList/index'
import circleNesting from '../components/home/circleNesting/index'
import colorfulArea from '../components/home/colorfulArea/index'
import waterPolo from '../components/home/waterPolo/index'


// window全局监听localStorage的setItem事件以及时更新
window.addEventListener('setItemEvent', function (e) {

    rainbow.store.dispatch("test",e.newValue);
    dynamicList.store.dispatch("test",e.newValue);

    ringPie.methods.getEchart(e.newValue);
    gauge.methods.getEchart(e.newValue);
    circleNesting.methods.getEchart(e.newValue);
    colorfulArea.methods.getEchart(e.newValue);
    waterPolo.methods.getEchart(e.newValue);

})